package org.grew.openEntity.repository;

import org.grew.openEntity.po.logic.ProjectEditionObj;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

/**
 * @program: open_entity
 * @author: todd
 * @create: 2019-01-05 21:39
 * @description: ${description}
 */
@Repository
public interface ProjectEditionRepository extends JpaRepository<ProjectEditionObj,Long> {

    @Query(value = "from ProjectEditionObj p where p.projectId=:projectId and p.editionId=:editionId")
    ProjectEditionObj checkProjectEdition(@Param("projectId") Long projectId,@Param("editionId") Long editionId);


    @Query(value = "select p1.projectName from ProjectEditionObj p,ProjectObj p1 where p.editionId=:editionId and p.projectId=p1.id")
    String getProjectByEditionId(@Param("editionId") Long editionId);
}
